<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./LogInTemplate.xhtml">

            <ui:define name="top">
                top
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <p:panel>
                            <p:growl/>
                        <h1><h:outputText value="User Create/Edit"/></h1>
                        <h:panelGrid columns="2">
                            <p:outputLabel value="Name:" for="name" />
                            <p:inputText id="name" value="#{userBean.user.name}" title="Name" required="true" requiredMessage="The Name field is required." validatorMessage="Incorrect Data">
                                <f:validateRegex pattern="^[A-Za-z\s]+$"/>
                            </p:inputText>
                            <p:outputLabel value="First name:" for="firstname" />
                            <p:inputText id="firstname" value="#{userBean.user.firstname}" title="Firstname" required="true" requiredMessage="The First name field is required." validatorMessage="Incorrect Data">
                                <f:validateRegex pattern="^[A-Za-z\s]+$"/>
                            </p:inputText>
                            <p:outputLabel value="Last name:" for="lastname" />
                            <p:inputText id="lastname" value="#{userBean.user.lastname}" title="Lastname" validatorMessage="Incorrect Data">
                                <f:validateRegex pattern="(^[A-Za-z\s]+$)?"/>
                            </p:inputText>
                            <p:outputLabel value="Acces Id:" for="accesId" />
                            <p:inputText id="accesId" value="#{userBean.user.accesId}" title="AccesId" required="true" requiredMessage="The Acces Id field is required."/>
                            <p:outputLabel value="Password:" for="password" />
                            <p:password inline="true" feedback="true" id="password" value="#{userBean.user.password}" title="Password" required="true" requiredMessage="The Password field is required."/>
                            <p:commandButton ajax="false" value="Accept" action="UserConfirm"/>
                            <p:commandButton value="Cancel" action="userList" immediate="true"/>
                        </h:panelGrid>
                        </p:panel>
                    </h:form>
                </f:view>
            </ui:define>
        </ui:composition>
    </body>
</html>
